#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    static const int N = 1e5 + 10;
    int dp[N][3];
    int minimumOperations(string leaves)
    {
        int len = leaves.size();
        memset(dp, 0x3f, sizeof(dp));
        dp[0][0] = (leaves[0] == 'y') ? 1 : 0;
        for (int i = 1; i < len; i++)
        {
            dp[i][0] = dp[i - 1][0] + (leaves[i] == 'y');
            dp[i][1] = min(dp[i - 1][1], dp[i - 1][0]) + (leaves[i] == 'r');
            dp[i][2] = min(dp[i - 1][2], dp[i - 1][1]) + (leaves[i] == 'y');
        }
        return dp[len - 1][2];
    }
};
int main()
{
    string s;
    cin >> s;
    Solution a;
    cout << a.minimumOperations(s) << endl;
    return 0;
}